<div class="right_side_operate_area">
	<?php  
		$user=$session->read('User');
		$istype=$action->checktype($user,"type");
		$companyid=$session->read("companyid");
		$isflag=true;
	
		if($showpage==1) {
			if(isset($paging)){ echo $this->renderElement('pagination',$paging);} 
		}
	?>
	<?php 
    	if($istype){
    		echo '<div class="right item_add_btn">';
			echo $html->link(__("Add",true),"/companys/editdormitorylease/");
			echo '</div>';
		}else{
			echo '<div class="right enableaction">';
			echo "<a>添加</a>";
			echo '</div>';
		}
	?>
	<div class="right_side_title left">
		<h2>
		<?php 
		$companyname=$session->read("companyname");
		echo $html->link($companyname,"/companys/showinfosummary/".$companyid);
		?>
		</h2>
		<div class="clear"></div>
	</div>
    <div class="clear"></div>
</div>


<div class="right_side_scollbar">
    <div class="detail_info_panel">
        <div class="items_list">
        	<table>
        		<tr >
        			<th>宿舍位置</th>
        			<th>宿舍大小( ㎡)</th>
        			<th>租赁期限</th>
        			<th>租金金额(￥)</th>
        			<th>操作</th>
        		</tr>
        		
        		<?php
        	    	foreach($dormitoryleases as $dormitorylease)
        	    	{
        	    		$id = $dormitorylease["CompDormitorylease"]["id"];
	        	    	echo "<tr class='per_list'>";
	        			$location = $dormitorylease["CompDormitorylease"]["location"];
	        			echo "<td>".$html->link($str->sub_len($location,20),"/companys/showdormitorylease/".$id,array("title"=>$location),null)."</td>";
	        			echo "<td>".$dormitorylease["CompDormitorylease"]["area"]."</td>";
	        			$starttime = date("Y/m/d",strtotime($dormitorylease["CompDormitorylease"]["starttime"]));
	        			$deadline = date("Y/m/d",strtotime($dormitorylease["CompDormitorylease"]["deadline"]));
	        			echo "<td>".$starttime."~".$deadline."</td>";
	        			echo "<td>".$dormitorylease["CompDormitorylease"]["rent"]."</td>";
	        			
	        			echo "<td>";
						if($istype)
						{
							echo $html->link(__("Edit",true),"/companys/editdormitorylease/".$id,null,null);
							echo $html->link(__("Delete",true),"/companys/deldormitorylease/".$id,array("onclick"=>"return doaction(this)"));
						}else
						{
							echo "<span class='enableaction'>编辑</span>";
							echo "<span class='enableaction'>删除</span>";
						}
						echo "</td>";
						
						echo "</tr>";
        			}
        		?>
        	</table>
        </div>
     </div>
 </div>
 <?php echo $this->element('actionconfirm',array("title"=>"删除提示","message"=>"你确定要删除吗？")) ?>